<?php 
session_start();

require('include/top.php');

$id_article=$_GET['id'];

//$articles = Article::getAll();
//$article = $articles[0];
//$article = $article->getArticleById($id_article);

echo $article;



/*$comment = Comment::getAll(1);

 foreach($comment as $value)
            {
				echo '</br>';
            	echo  $value. '</br>';
            } 
*/


if ( (isset($_POST['writer']) && isset($_POST['content'])) ) 
{

		$nvComment= new Comment();//new Comment($result['com_id'],$result['com_article_id'],$result['com_content'], $result['com_writer'], $result['com_date'] );
				
		$nvComment->com_writer= $_POST['writer']; 
		$nvComment->com_content= $_POST['content']; 
		$nvComment->com_article_id = 1; // RECUPERER L ID DE L ARTICLE
		$nvComment->insert();
		
		//insert($_POST['writer']), $_POST['content'], 1) 
}

include('templates/header.tpl.php');
include('templates/article.tpl.php');
include('templates/footer.tpl.php'); 


?>